#include<cstdio>
#include<cstdlib>
struct node{
    int x,y;
	int step;
	int prex,prey;
};
int x,y,z;
int head=1,tail=1;
bool mark[110][110];
node water[1110];
void bfs(node p){
    if(p.x+p.y<=y&&mark[0][p.y+p.x]==0){
        tail++;
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=0;water[tail].y=p.x+p.y;    
        water[tail].step=p.step+1;
        mark[0][p.y+p.x]=1;  
    }
    else if(p.x+p.y>y&&mark[p.x+p.y-y][y]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=p.x+p.y-y;water[tail].y=y;        
        water[tail].step=p.step+1;
        mark[p.x+p.y-y][y]=1;       
    }
    if(p.x+p.y<=x&&mark[p.y+p.x][0]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=p.x+p.y;water[tail].y=0;        
        water[tail].step=p.step+1;
        mark[p.y+p.x][0]=1;     
    }
    else if(p.x+p.y>x&&mark[x][p.x+p.y-x]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=x;water[tail].y=p.x+p.y-x;        
        water[tail].step=p.step+1;
        mark[y][p.x+p.y-y]=1;       
    }
    if(mark[x][p.y]==0){
        tail++;
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=x;water[tail].y=p.y;       
        water[tail].step=p.step+1;  
        mark[x][p.y]=1;     
    }
    if(mark[p.x][y]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=p.x;water[tail].y=y;        
        water[tail].step=p.step+1;
        mark[p.x][y]=1;     
    }
    if(mark[0][p.y]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=0;water[tail].y=p.y;        
        water[tail].step=p.step+1;
        mark[0][p.y]=1;     
    }
    if(mark[p.x][0]==0){
        tail++;     
        water[tail].prex=p.x;water[tail].prey=p.y;
        water[tail].x=p.x;water[tail].y=0;        
        water[tail].step=p.step+1;
        mark[p.x][y]=1;     
    }
    head++;
}
int ans=0;
void dg(int a,int b){
    int i=1;
    if(water[1].x==a&&water[1].y==b){
        //printf("%d\n",water[1].step);
        return;
    }
    else
    {
    while(i<tail){
        if(water[i].x==a&&water[i].y==b){
            dg(water[i].prex,water[i].prey);
            if(ans<water[i].step) ans+=1;
            //printf("%d\n",water[i].step);
            break;
        }
        i++;
    }
}
}
int flag=0;
void work(){
    
    while(head<=tail){ 
        if(water[head].y==z){
            flag++;break;
        }
        bfs(water[head]);
    }
    if(flag!=1)
	{
		printf("No solution!");	
		return;
	}
    else if(flag==1){
        dg(water[head].x,water[head].y);
    }
}
int main(){
    scanf("%d%d%d",&x,&y,&z);
    water[1].x=x;water[1].y=0;water[1].step=0;
    mark[water[1].x][water[1].y]=1;
    work();
    if(flag==1)
	{
    	printf("%d",ans);
    }
}

